package com.shiku.staticstic.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.shiku.staticstic.service.Response;

public class AbstractController {
	
	protected static void out(HttpServletResponse response, Response responseData) {
		PrintWriter out = null;
		response.setCharacterEncoding("utf-8");
		response.setContentType("application/json; charset=utf-8");
		try {
			out = response.getWriter();
			out.print(JSON.toJSON(responseData));
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (out != null) {
				out.close();
			}
		}
	}

}
